import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import 'amfe-flexible' // 引入flexible.js -> 设置跟标签字体大小(做移动端的适配)
import {
  NavBar, Form, Icon, Field, Button, Tabbar, TabbarItem, Tab, Tabs, Sticky, cell, List,
  PullRefresh, ActionSheet, Search, Popup, Row, Col, Badge
} from 'vant'
Vue.use(NavBar).use(Form).use(Field).use(Button).use(Tabbar).use(TabbarItem).use(Icon).use(Tab).use(Tabs).use(Sticky).use(cell)
Vue.use(List).use(PullRefresh).use(ActionSheet).use(Search).use(Popup).use(Row).use(Col).use(Badge)
Vue.config.productionTip = false

const obj = {
  install (Vue) {
    // 注册全局组件
    Vue.directive('fofo', {
      // 指令所有van-search组件
      // 组件根在div input在内部
      // 所有需要找到input标签
      inserted (el) {
        const input = document.querySelector('input')
        input.focus()
      }
    })
  }
}

Vue.use(obj)

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
